<?php

/*
 * 操作记录控制器
 * @author turtle
 * create_time 2017-01-04
 */


namespace App\Admin\Controllers\Sets;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Intervention\Image\Constraint;
use Intervention\Image\Facades\Image;
use App\Admin\Controllers\Controller;
use App\Admin\Models\User;
use App\Admin\Models\Logs;

class LogController extends Controller {

    /*
     * 查看用户操作记录
     * @author turtle
     * create_time 2017-01-04
     */

    public function index() {
        $bool = User::checkUserPermissions('check_log'); 
        if (!$bool) {                                                
            return redirect() 
                ->route('admin.dashboard')
                ->with([
                    'message' => "您没有拥有该权限，请联系管理员",
                    'alert-type' => 'error',
                ]);               
        }
        $logs = Logs::orderBy('created_at', 'desc')->get();

        $datas['logs'] = $logs;
        return view('admin.log', $datas);
    }

}
